package com.example.demo.base.sysSwitch.controller;

import com.example.demo.base.sysSwitch.service.SysSwitchService;
import com.example.demo.dto.ResponseDto;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * TODO
 * @date2024/3/4
 * @modify -----------------------------------------------------------------------------------------------------
 * |修改单号|修改人员|修改日期|评审人员|修改说明
 * -----------------------------------------------------------------------------------------------------
 * |      |       |      |       |
 * -----------------------------------------------------------------------------------------------------
 */

@RequestMapping("/sys")
@RestController
public class SysSwitchController {

    @Resource
    private SysSwitchService sysSwitchService;


    @PostMapping("/switch/open")
    public ResponseDto open(HttpServletRequest request) {
        sysSwitchService.open();
        return new ResponseDto<>().buildSucceedHasData(true);
    }

    @PostMapping("/switch/close")
    public ResponseDto close(HttpServletRequest request) {
        sysSwitchService.close();
        return new ResponseDto<>().buildSucceedHasData(true);
    }

    @PostMapping("/switch/query")
    public ResponseDto query(HttpServletRequest request) {

        return new ResponseDto<>().buildSucceedHasData(sysSwitchService.query());
    }
}
